{% extends '::frontend.html.twig' %}

{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/rs/css/smart_cart.css')}}">
{% endblock %}

{% block statusTitle %}
<h1>Nueva Reserva <small> Carrito de la Compra</small></h1>
{% endblock %}

{% block contenido %}


<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr><td>  
<form id="cartForm" method="post">
<!-- Smart Cart HTML Starts -->
  <fieldset>
  
  <legend><span class="glyphicon glyphicon-wrench"></span> Seleccione uno o varios trabajos</legend>
	{% for flashMessage in app.session.flashbag.get('no_services') %}
    	<div class="flash-notice">
       	<p class="text-danger"> {{ flashMessage }} </p>
    	</div>
	{% endfor %}
  

  <div id="SmartCart" class="scMain">
	{% for gremio in services %}
		{% for producto in gremio.products %}
			<input type="hidden" pimage="" pprice="{{ producto.price }}" pdesc="{{ producto.description }}" pcategory="{{ gremio.name }}" pname="{{ producto.name }}" pid="{{ producto.id }}">
		{% endfor %}
	{% endfor %}
  </div>
  </fieldset>
<!-- Smart Cart HTML Ends -->
</form>
</td></tr>
</table>

{% endblock %}


{% block javascripts %}
<script type="text/javascript" src="{{asset('bundles/rs/js/jquery.smartCart-2.0.js')}}"></script>
<script type="text/javascript">
$(document).ready(function(){
    	// Call Smart Cart    	
 	$('#SmartCart').smartCart({
	   selected: 0,  // 0 = produts list, 1 = cart  
	   resultName: 'products_selected[]', 
	   enableImage: false,
	   enableImageTooltip: false,
	   enableSearch: true,
	   enableCategoryFilter: true,
	   onAdded: function(pObj,quantity){
			console.log(pObj);
			$(pObj).remove();
		   },
           onRemoved: null  // function(pObj){ } 
		});
	$("#cartForm").on("submit",function(e){
		$("#curtain").show();
	});
});
</script>
{% endblock %}
